#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>

int pn(int k) {
	int sum = 1;
	for (int i = 2; i <= sqrt(k); i++) {
		if (k % i == 0) {
			sum += i;
			int tmp = k / i;
			if (tmp != sqrt(k)) {
				sum += tmp;
			}
		}
	}
	if (sum == k)
		return 1;
	else
		return 0;
}

int main() {
	int n = 0;
	while (scanf("%d", &n) != EOF) {
		int count = 0;
		for (int i = 2; i  <= n; i++) {
			int ret = pn(i);
			if (ret)
				count++;
		}
		printf("%d", count);
	}
	return 0;
}